<template>
	<div class="page">
		<div class="bok-contens">
			<div class="header">
				<img class="label1 isTrigger" referrerpolicy="no-referrer" src="https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngb2c4cc2f6608571bcfef8aca5296fa033a09a7881b3f8ae1f79b4406a58246e5" @click="onPrevious" />
				<span class="info1">重要事项告知书(3/3)</span>
			</div>
			<hr class="hr" />
			<div class="text-conent">
				<span class="txt1">免责条款</span>
				<ul>
					<li>因下列原因造成被保险人身故或伤残的，保险人不承担给付保险金责任:</li>
					<li>(一)投保人的故意行为;</li>
					<li>(二)被保险人自致伤害或自杀，但被保险人自杀时为无民事行为能力人的除外;</li>
					<li>(三)因被保险人挑衅或故意行为而导致的打斗、被袭击或被谋杀;</li>
					<li>(四)被保险人妊娠、流产、分娩、疾病、药物过敏、中暑、猝死;</li>
					<li>(五)被保险人接受整容手术及其他内、外科手术;</li>
					<li>(六)被保险人未遵医嘱，私自服用、涂用、注射药物;</li>
					<li>(七)核爆炸、核辐射或核污染;</li>
					<li>(八)恐怖袭击;</li>
					<li>(九)被保险人犯罪或拒捕;</li>
					<li>(六)被保险人未遵医嘱，私自服用、涂用、注射药物;</li>
					<li>(十)被保险人从事高风险运动或参加职业或半职业体育运动。</li>
					<li>(十一)战争、军事行动、暴动或武装叛乱期间;</li>
					<li>(十二)被保险人醉酒或毒品、管制药物的影响期间;</li>
					<li style="margin-bottom: 25px;">(十三)被保险人酒后驾车、无有效驾驶证驾驶或驾驶无有效行驶证的机动车期间。</li>
					<li>被保险人在下列期间遭受伤害导致身故或伤残的，保险人也不承担给付保险金责任:</li>
					<li>(一)战争、军事行动、暴动或武装叛乱期间;</li>
					<li>(二)被保险人醉酒或毒品、管制药物的影响期间;</li>
					<li>(三)被保险人酒后驾车、无有效驾驶证驾驶或驾驶无有效行驶证的机动车期间。</li>
				</ul>
			</div>
			<hr />
			<div class="btn" @click="stopScreenSync">
				<div type="warning" class="div-btn"><div class="btn-text">进入通话</div></div>
			</div>
		</div>
		<invite-members v-if="showinvteModelView" :showinvteModelView="showinvteModelView" @colseCancel="colseCancel" @linkGeneration="linkGeneration" :sessionId="sessionId" :createInviteCode="createInviteCode"></invite-members>
	</div>
</template>

<script>
import InviteMembers from '../../components/InviteMembers.vue';
import {createInviteVisitorsCode} from '../../api/api';
export default {
	components: { InviteMembers },
	mounted(){
		this.onInviteCustomer();
	},
	data(){
		return{
			createInviteCode: '', 
			showinvteModelView: false, // 是否显示邀请访客的弹框
			sessionId: '', // 邀请访客加入的sessionId
		}
	},
	methods: {
		onPrevious() {
			this.$router.push({ path: '/pagesecond' });
		},
		stopScreenSync(){
			console.log('stopScreenSync');
			ivcsCustomer.stopScreenSync();
			// ivcsCustomer.upgradeCall((s)=>{
            //     console.log('upgradeCall',s);
			// },(e)=>{
			// 	console.log('upgradeCall',e);
			// })
		},
		// 收到邀请访客的消息
		onInviteCustomer() {
			ivcsCustomer.onInviteCustomer((sessionId, bizId, org, token) => {
				console.log(sessionId, 'onInviteCustomer', bizId, org, token);
				if (bizId) {
					sessionStorage.setItem('service', bizId);
				}
				if (org) {
					localStorage.setItem('org', org);
				}
				token && localStorage.setItem('customer_token', token);
				this.sessionId = sessionId;
				this.showinvteModelView = true;
				setTimeout(() => {
					let box = document.querySelector('.ivu-modal-wrap');
					console.log(box);
					box && box.setAttribute('style', 'z-index:999999999');

					let shadow = document.querySelector('.ivu-modal-mask');
					console.log(shadow);
					shadow && shadow.setAttribute('style', 'z-index:9999999');
				}, 300);
			});
		},
		// 邀请成员 弹框 显示
		inviteVistors() {
			this.showinvteModelView = true;
		},
		// 关闭邀请成员弹框
		colseCancel() {
			this.showinvteModelView = false;
		},
		// 链接生成
		linkGeneration(form, setStatus) {
			console.log(form);
			let bizScenId = sessionStorage.getItem('service');
			let data = {
				bizScenId: bizScenId,
				org: localStorage.getItem('org'),
				type: form.isReuseSwitch === true ? 0 : 1,
				sessionId: this.sessionId,
				customerId: form.userName,
				customerRole: form.role,
				startDate: form.startTime,
				endDate: form.endTime
			};
			createInviteVisitorsCode(data)
				.then(res => {
					if (res.data) {
						console.log(res.data);
						this.createInviteCode = encodeURIComponent(res.data);
						this.$Message.success('链接已生成');
						setStatus('success');
					}
					setTimeout(() => {
						let box = document.querySelector('.ivu-message');
						console.log(box);
						box && box.setAttribute('style', 'z-index:999999999');
					}, 200);
				})
				.catch(err => {
					console.log(err);
					if (err.data && err.data.code === 1301) {
						this.$Message.error('请选择有效的链接有效期');
						console.log(err.data.code, 'code');
						setTimeout(() => {
							setStatus('success');
							setStatus('idle');
						}, 500);
					} else {
						this.$Message.error('链接生成失败');
						setStatus('idle');
					}
					setTimeout(() => {
						let box = document.querySelector('.ivu-message');
						console.log(box);
						box && box.setAttribute('style', 'z-index:999999999');
					}, 200);
				});
		}
	}
};
</script>

<style scoped>
.page {
	height: 100%;
	width: 100%;
	overflow: hidden;
	font-family: serif;
}
.bok-contens {
	height: 100%;
	height: 100%;
}
.header {
	padding: 30px;
}
.info1 {
	font-size: 16px;
	width: 150px;
	height: 22px;
	font-weight: bold;
}
.label1 {
	width: 10px;
	height: 20px;
	position: absolute;
	left: 20px;
	top: 31px;
}
.hr {
	margin-bottom: 10px;
}
.text-conent {
	padding: 15px;
	height: 66%;
	overflow-y: auto;
}
.txt1 {
	height: 16px;
	font-size: 14px;
	font-weight: bold;
	float: left;
	border-bottom: 6px solid #fb8f6a;
	padding-bottom: 14px;
	margin-bottom: 10px;
}
ul {
	width: 100%;
	display: flex;
	flex-flow: column;
	align-items: flex-start;
}
li {
	font-size: 12px;
	font-weight: 400;
	line-height: 18px;
	padding: 4px 0;
	text-align: left;
}
.btn {
	clear: both;
	height: 82px;
	padding-top: 12px;
	justify-content: center;
	align-items: center;
	display: flex;
}
.div-btn {
	width: 345px;
	height: 44px;
	border-radius: 5px;
	/* padding-top: 12px;
        padding-bottom: 12px; */
	background-color: #ff6000;
}
.btn-text {
	font-size: 14px;
	color: #fff;
	height: 44px;
	line-height: 44px;
}
.li-span {
	height: 20px;
}
.conent-color {
	width: 64px;
	height: 5px;
	background: #fb8f6a;
	position: absolute;
	top: 127px;
	left: 12px;
}
</style>
